package com.th.therp.mapper;

import com.th.therp.pojo.emtity.Customer;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface CustomerMapper {

    //查询全部客户
    @Select("select * from customer where is_deleted = 0")
    List<Customer> list();

    //新增客户
    @Insert("insert into customer (name,contact,phone,email,is_deleted) values (#{name},#{contact},#{phone},#{email},0)")
    void add(Customer customer);

    void update(Customer customer);

    //根据id查询客户名称
    @Select("select name from customer where id=#{customerId} and is_deleted = 0")
    String findNameById(Integer customerId);

    //根据名称查询客户
    @Select("select * from customer where name=#{name} and is_deleted=0")
    Customer findByName(String name);
}